package com.isoftstone.service.Impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.isoftstone.dao.UncheckDao;
import com.isoftstone.entity.Diagnosis;
import com.isoftstone.entity.Patient;
import com.isoftstone.entity.Register;
import com.isoftstone.service.UncheckService;

@Service("UncheckService")
public class UncheckServiceImpl implements UncheckService{
	@Autowired
	private UncheckDao uncheckDao;
	
	@Override
	public List<Patient> getAllPatient() {
		// TODO Auto-generated method stub
		List<Patient> list=uncheckDao.getAllPatient();
		return list;
	}
	@Override
	public List<Register> getWaitingPatient(){
		// TODO Auto-generated method stub
			List<Register> list =uncheckDao.getWaitingPatient();
			return list;
	}
	@Override
	public boolean deleteRegister(String guahao_id){
		// TODO Auto-generated method stub
		if(guahao_id!=null ){
			boolean flag =uncheckDao.deleteRegister(guahao_id);
			if(flag){
				return true;
			}
		}
		return false;
	}
	@Override
	public Register getRegisterByGuahaoId(String guahao_id){
		// TODO Auto-generated method stub
		if(guahao_id!=null ){
			Register register =uncheckDao.getRegisterByGuahaoId(guahao_id);
			
			return register;
		}
		return null;
	}
	@Override
	public boolean editRegister(String guahao_id,int zhenduan_type){
		// TODO Auto-generated method stub
		if(guahao_id!=null && (zhenduan_type==0 || zhenduan_type==1)){
			boolean flag =uncheckDao.editRegister(guahao_id,zhenduan_type);
			if(flag){
				return true;
			}
		}
		return false;
	}
	@Override
	public boolean insertDiagnosis(String diagnose_id,String guahao_id,String patient_telling,String present_illness,String past_illness,String allergy_illness,Date date_illness,String diagnose_content,String diagnose_remark,String plan_illness){
		// TODO Auto-generated method stub
		if(diagnose_id!=null && guahao_id!=null && patient_telling!=null && present_illness!=null && past_illness!=null && allergy_illness!=null && date_illness!=null && diagnose_content!=null && diagnose_remark!=null && plan_illness!=null){
			boolean flag =uncheckDao.insertDiagnosis(diagnose_id,guahao_id,patient_telling,present_illness,past_illness,allergy_illness,date_illness,diagnose_content,diagnose_remark,plan_illness);
			if(flag){
						return true;
				}	
			}
		return false;
	}
}
